Page({
 data: {
  banner: [],
  tabList: [],
  activityList: [],
  height: ''
 },
 onLoad(options) {
  // Loading
  wx.showLoading({
   title: '加载中',
  })
  // banner数据
  wx.request({
   url: 'https://starmid.minutestars.com/api/index/GetBanners',
   success: (res) => {
    let {
     Result,
     Data
    } = res.data
    if (Result.Success) {
     this.setData({
      banner: Data
     })
     // 关闭Loading
     wx.hideLoading()
    }
   }
  })
  // tabList数据
  wx.request({
   url: 'https://starmid.minutestars.com/api/index/GetProductCategories',
   method: 'GET',
   success: (res) => {
    let {
     Result,
     Data
    } = res.data
    if (Result.Success) {
     this.setData({
      tabList: Data
     })
    }
   }
  }),
   // activityList数据
   wx.request({
    url: 'https://starmid.minutestars.com/api/index/GetProductAreas',
    method: 'GET',
    success: (res) => {
     // console.log(res);
     let { Result, Data } = res.data
     if (Result.Success) {
      this.setData({
       activityList: Data
      })
     }
    }
   }),
   wx.getSystemInfo({
    success: res => {
     let menuButtonObject = wx.getMenuButtonBoundingClientRect();
     let statusBarHeight = res.statusBarHeight;
     // 导航栏高度
     let navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
     this.setData({ height: navHeight })
    },
    fail(err) {
     console.log(err);
    }
   })
 },


})